﻿/*
Copyright (c) 2011 <a href="http://www.gutgames.com">James Craig</a>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.*/

#region Usings
using System;
using System.Linq.Expressions;

#endregion

namespace HaterAide.Interfaces
{
    /// <summary>
    /// Class mapping interface
    /// </summary>
    /// <typeparam name="T">The type of the object being mapped</typeparam>
    public interface IClassMap<T>
    {
        #region Functions
        
        /// <summary>
        /// Used to specify an ID property
        /// </summary>
        /// <param name="expression">The property defined in an expression (x=>x.PropertyName)</param>
        /// <param name="AutoIncrement">Determines if we auto increment the item (not currently used)</param>
        /// <param name="PropertyName">The column name in the database (if left empty, one is generated)</param>
        void ID(Expression<Func<T, object>> expression, bool AutoIncrement,string PropertyName="");

        /// <summary>
        /// Used to specify an ID property
        /// </summary>
        /// <param name="expression">The property defined in an expression (x=>x.PropertyName)</param>
        /// <param name="Length">The maximum length of the string</param>
        /// <param name="PropertyName">The column name in the database (if left empty, one is generated)</param>
        void ID(Expression<Func<T, object>> expression, int Length, string PropertyName = "");

        /// <summary>
        /// Used to specify a reference property (simple types such as an int or float)
        /// </summary>
        /// <param name="expression">The property defined in an expression (x=>x.PropertyName)</param>
        /// <param name="PropertyName">The column name in the database (if left empty, one is generated)</param>
        void Reference(Expression<Func<T, object>> expression, string PropertyName = "");

        /// <summary>
        /// Used to specify a reference property (used for string types)
        /// </summary>
        /// <param name="expression">The property defined in an expression (x=>x.PropertyName)</param>
        /// <param name="Length">The maximum length of the string</param>
        /// <param name="PropertyName">The column name in the database (if left empty, one is generated)</param>
        void Reference(Expression<Func<T, object>> expression, int Length, string PropertyName = "");

        /// <summary>
        /// Used to specify a mapped property (used for one to one mapped classes)
        /// </summary>
        /// <param name="expression">The property defined in an expression (x=>x.PropertyName)</param>
        /// <param name="Cascade">Determines whether a save cascades to the object it points to</param>
        void Map(Expression<Func<T, object>> expression, bool Cascade);

        /// <summary>
        /// Used to specify a mapped property (used for many to one mapped classes)
        /// </summary>
        /// <param name="expression">The property defined in an expression (x=>x.PropertyName)</param>
        /// <param name="MappedProperty">The table this property should map to (this should be symmetric if defined in the other class)</param>
        /// <param name="Cascade">Determines whether a save cascades to the object it points to</param>
        void ManyToOne(Expression<Func<T, object>> expression, string MappedProperty, bool Cascade);

        /// <summary>
        /// Used to specify a mapped property (used for many to many mapped classes)
        /// </summary>
        /// <param name="expression">The property defined in an expression (x=>x.PropertyName)</param>
        /// <param name="MappedProperty">The table this property should map to (this should be symmetric if defined in the other class)</param>
        /// <param name="Cascade">Determines whether a save cascades to the object it points to</param>
        void ManyToMany(Expression<Func<T, object>> expression, string MappedProperty, bool Cascade);

        /// <summary>
        /// Used to specify the table name to be used
        /// </summary>
        /// <param name="TableName">Name of the table</param>
        void Table(string TableName);

        #endregion
    }
}
